﻿@using eCollabro.Client.Models.Core;
@using eCollabro.Web.Base;
@model eCollabro.Client.Models.Core.LoginModel
<script type="text/javascript" src="~/app/controllers/account/login.js"></script>
<div id="divContainerLogin" ng-controller="loginController">
    @Html.Partial("_PageHeader", new PageHeaderModel { PageTitle = "Login", ViewId = "Login", ValidateForm=true })
    @Html.Partial("~/Views/Account/ForgotPassword.cshtml")
    <div class="row">
        <div class="col-md-8">
            <section id="loginForm">
                @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form", id = "frmLogin" }))
                {
                    @Html.AntiForgeryToken()
                    
                    @Html.HiddenFor(m => m.AuthToken)
                    <h4>Use a local account to log in.</h4>
                    <hr />
                        <div class="form-group">
                            @Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
                            <div class="col-md-6">
                                @Html.TextBoxFor(m => m.UserName, new { ng_model = "loginRequest.username", @class = "form-control", maxlength = 50 })
                                @Html.ValidationMessageFor(m => m.UserName)
                            </div>
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label", maxlength = 20 })
                            <div class="col-md-6">
                                @Html.PasswordFor(m => m.Password, new { ng_model = "loginRequest.password", @class = "form-control" })
                                @Html.HiddenFor(m => m.Password, new { id="hdnPassword" })
                                @Html.ValidationMessageFor(m => m.Password)
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-offset-2 col-md-10">
                                <div class="checkbox">
                                    @Html.CheckBoxFor(m => m.RememberMe)
                                    @Html.LabelFor(m => m.RememberMe)
                                </div>
                            </div>
                        </div>
                         <div class="form-group">
                            <div class="col-md-offset-2 col-md-10">
                                <input type="button" value="Log in" class="btn btn-primary" ng-click="login()" />
                                <input type="button" value="Forgot Password" class="btn btn-default" ng-click="forgetPassword()" ng-disabled="forgetPasswordButtonDisabled" />
                            </div>
                        </div>
                        <p>
                            @*@if (ViewBag.AllowRegistration)
                                {*@
                            <div>
                                @Html.ActionLink("Register", "Register") if you don't have a local account.
                            </div>
                            @*}*@
                        </p>
                        }
</section>
        </div>
    </div>
</div>